<template>
	<view>
		<view class="tips_control" :class="[show_tips('style')]" @click="btn_click()" v-if="show_tips('show')">
			<image class="tips_icon" src="/static/images/tips_top.png"></image>
			<view class="tt">
				{{ show_tips('title') }}
			</view>
		</view>
	</view>
</template>

<script>
import storeMixin from '@/store/storeMixin';
export default {
	mixins: [storeMixin],
	name: 'judgeTips',
	props: {
		judge_login: {
			type: Object,
			default: {},
		},
		judge_connect: {
			type: Object,
			default: {},
		},
	},
	data() {
		return {};
	},
	created() {},
	mounted() {},

	watch: {},

	methods: {
		show_tips(type) {
			let _this = this;
			let _t = '';
			let _s = '';
			let _f = false;

			let page_login = _this.USER_LOGIN;
			let { bluetooth_connect } = _this.BLUETOOTH_DEVICE_CONFIG;

			if (!page_login) {
				_f = true;
				_t = '请先登录账户';
				_s = 'need_login';
			} else if (!bluetooth_connect) {
				_f = true;
				_t = '请先连接设备';
				_s = '';
			}

			if (type == 'title') {
				return _t;
			} else if (type == 'style') {
				return _s;
			} else {
				return _f;
			}
		},

		btn_click() {
			let _this = this;
			_this.$emit('trigger_connect_judge');
		},
	},
};
</script>

<style lang="scss">
.tips_control {
	height: 60rpx;
	border-radius: 10rpx;
	background-color: #ff5656;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 20rpx 30rpx;

	&.need_login {
		background-color: #ff8245;
	}

	.tips_icon {
		width: 30rpx;
		height: 30rpx;
		margin-right: 6rpx;
	}

	.tt {
		font-size: 28rpx;
		font-weight: 400;
		color: #ffffff;
		line-height: 1;
	}
}
</style>
